import request from '@/utils/request'

// 库位管理
export const getList = (data) => request.get('/api/location/pageDetail', {
  params: {
    areaName: data.areaName,
    name: data.name,
    current: data.current,
    size: data.size
  }
})

// 转换type接口
export const changeStatus = (data) => request.put('/api/location', data)

// 搜索接口
export const search = (data) => request.get('/api/location/pageDetail', {
  params: {
    areaName: data.areaName,
    name: data.name,
    size: data.size,
    current: data.current,
    status: data.status
  }
})

// 导入接口
export const importStock = (data) => request({
  method: 'post',
  url: '/api/location/upload',
  headers: {
    'Content-Type': 'multipart/form-data;' // 设置请求头请求格
  },
  data: data
})

// detail2 的接口
export const status = () => request.get('/api/warehouse/list?status=1')
export const code = () => request.get('/api/codeFactory/next/KW')

export const childrenStatus = (id) => request.get(`/api/area/list?warehouseId=${id}&status=1`)

// 新建提交接口
export const add = (data) => request.post('/api/location', data)

// 编辑获取信息接口
export const getEdit = (id) => request.get(`/api/location/${id}`)

// 编辑提交接口
export const editSubmit = (data) => request.put('/api/location', data)
